<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of load
 *
 * @author 12502
 */
include_once 'php\ld\findInDatabase.php';

class load {

    public function upload($username, $password, $web, $preweb) {
        $count = findInDatabase::findPassword($username, $password);
        if ($count > 0) {
            session_start();
            $_SESSION['one'] = $username;
            $upload == 1;
            $_SESSION['two'] = $upload;
            header("Location: '$web'");
        } else {
            echo"<script>alert('密码或用户名错误');location.href='$preweb'</script>";
        }
    }

    public static function loaded($username,$load) {
        $name = findInDatabase::findName($username);
        $image= findInDatabase::findImage($username);
        if ($load == "1") {
            $docker = array($username, $name, $load,$image);
            return $docker;
        } else {
            $docker = array(0, 0, 0,0);
            return $docker;
        }
    }


    public static function ifLoad($web) {
        error_reporting(E_ALL ^ E_NOTICE);
        $load = $_SESSION['two'];

        if ($load != "1") {
            echo '<button type="submit" class="btn btn-2 " onclick="alert()">开始测试</button></a>';
        }
        if ($load == "1") {
            echo "<a href= '$web' <button type='submit' class='btn btn-2' >开始测试</button>></a>";
        }
    }

}
